package com.example.trueorfalse.activity;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.example.trueorfalse.R;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "MainActivity";
    private static final int REQUEST_QUESTION_ACTIVITY = 1;
    //Button控件的对象，布局内所有控件，都声明成成员变量
    private Button mButton;
    //ImageView控件的对象，布局内所有控件，都声明成成员变量
    private ImageView mDemoImageview;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //加载当前activity对应的布局文件
        setContentView(R.layout.activity_main);

        //通过ID从布局中拿到各种控件

        Button mButton1 = findViewById(R.id.Button_no);
        mDemoImageview = findViewById(R.id.image_view_demo);


        //是按钮，确认点击事件
        mButton = findViewById(R.id.Button_yes);
        mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"好的，那我们开始查户口吧！",Toast.LENGTH_SHORT)
                        .show();
                jumpSecondActivity();

            }
        });

        //否按钮
        mButton1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"不行，必须参加！",Toast.LENGTH_SHORT)
                        .show();
            }
        });
    }

    //跳转到第二个活动页
    public void jumpSecondActivity(){
       Intent intent = SecondActivity.newIntent(MainActivity.this, "开始答题");
       startActivityForResult(intent,REQUEST_QUESTION_ACTIVITY);
    }

    public void loadImageView(){

    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }

}